package com.lebang.feign;

import com.lebang.feign.fallback.NewsEarnedFallback;
import com.lebang.model.RequestUserInfo;
import com.lebang.model.back.Result;
import com.lebangweb.response.JsonData;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author xwj
 */
@FeignClient(name = "wangzhuan-earns", contextId = "wangzhuan-earns-news", fallback = NewsEarnedFallback.class)
public interface NewsEarnedFeign {

    /**
     * 开关--app
     *
     * @return 返回结果
     */
    @ApiOperation("开关")
    @PostMapping("/news/enable")
    JsonData enable(@RequestBody RequestUserInfo request, @RequestParam(value = "key", required = false) String key);

    /**
     * 任务列表--app
     *
     * @return 返回结果
     */
    @ApiOperation("任务列表")
    @PostMapping("/news/list")
    JsonData list(@RequestBody RequestUserInfo request,
                  @RequestParam(value = "key", required = false) String key,
                  @RequestParam(value = "page", required = false) Long page,
                  @RequestParam(value = "limit", required = false) Integer limit);

    /**
     * 领取任务--app
     *
     * @return 返回结果
     */
    @ApiOperation("领取任务")
    @PostMapping("/news/pull")
    JsonData pull(@RequestBody RequestUserInfo request);

    /**
     * 提交任务--app
     *
     * @param request
     * @return
     */
    @ApiOperation("提交任务")
    @PostMapping("/news/push")
    Result<Integer> push(@RequestBody RequestUserInfo request, @RequestParam(value = "id", required = false) Long id);


    /**
     * 双倍 --app
     *
     * @param request
     * @param id
     * @return
     */
    @ApiOperation("双倍")
    @PostMapping("/news/double")
    Result<Integer> doubleCount(@RequestBody RequestUserInfo request, @RequestParam(value = "id", required = false) Long id);
    /**
     * 获取今日已做次数
     *
     * @param request 请求数据
     * @return 返回结果
     */
    @ApiOperation("获取今日已做次数")
    @PostMapping("/news/total")
    Result<Integer> total(@RequestBody RequestUserInfo request) ;

    /**
     * 新闻分类列表
     * @return 返回结果
     */
    @ApiOperation("新闻分类列表")
    @PostMapping("/news/category")
    JsonData category(@RequestBody RequestUserInfo userInfo);

    /**
     * 新闻列表
     * @return 返回结果
     */
    @ApiOperation("新闻列表")
    @PostMapping("/news/news")
    JsonData news(@RequestParam(value = "category",required = false) String category,@RequestParam(value = "page", required = false)  Long page,@RequestParam(value = "limit", required = false) Integer limit);

    /**
     * 获取用户新闻种类
     */
    @ApiOperation("用户新闻种类")
    @PostMapping("/news/membercategory")
    JsonData getNewsCategory(@RequestBody RequestUserInfo request);

    /**
     * 更新用户种类
     * @param request
     * @param categorys
     * @return
     */
    @ApiOperation("更新用户种类")
    @PostMapping("/news/updatecategory")
    JsonData updateCategory(@RequestBody RequestUserInfo request,@RequestParam(value = "categorys", required = false) String categorys);

    /**
     * 获取用户资讯收藏记录
     * @param request
     * @return
     */
    @ApiOperation("获取用户资讯收藏记录")
    @PostMapping("/news/record")
    JsonData getRecord(@RequestBody RequestUserInfo request, @RequestParam(value = "page", required = false)Long page, @RequestParam(value = "limit", required = false)Integer limit);

    /**
     * 用户资讯收藏
     * @param request
     * @param title
     * @param source
     * @param itemId
     * @return
     */
    @ApiOperation("用户资讯收藏")
    @PostMapping("/news/collect")
    JsonData collect(@RequestBody RequestUserInfo request,
                            @RequestParam(value = "title", required = false) String title,
                            @RequestParam(value = "source", required = false) String source,
                            @RequestParam(value = "itemId", required = false) String itemId);

    /**
     * 用户取消资讯收藏
     * @param request
     * @param itemId
     * @return
     */
    @ApiOperation("用户取消资讯收藏")
    @PostMapping("/news/del/collect")
    JsonData delCollect(@RequestBody RequestUserInfo request, @RequestParam(value = "itemId", required = false) String itemId);

    /**
     * 用户取消资讯收藏
     * @param request
     * @param itemId
     * @return
     */
    @ApiOperation("用户取消资讯收藏")
    @PostMapping("/news/isCollect")
    JsonData isCollect(@RequestBody RequestUserInfo request,@RequestParam(value = "itemId", required = false) String itemId);

    /**
     * 资讯查询
     * @param userInfo
     * @param itemId
     * @return
     */
    @ApiOperation("资讯查询")
    @PostMapping("/news/get")
    JsonData get(@RequestBody RequestUserInfo userInfo,@RequestParam(value = "itemId", required = false) String itemId);
}
